{extend name="platform/base" /}

 {block name="resources"/}

  {/block} {block
name="right_tab"}
<li><a class="nscs-table-handle_green" href="javascript:;"
	onclick="addExpress()">添加运费模板</a></li>
{/block} {block name="main"}
<table class="mytable">
	<tr>
			<th>模板名称</th>
		<th width="31%"><input type="text" /><input type="button"
			value="搜索" /></th>
	</tr>
</table>
<div class="" style="display: none; position: absolute;"><div class="aui_outer"><table class="aui_border"><tbody><tr><td class="aui_nw"></td><td class="aui_n"></td><td class="aui_ne"></td></tr><tr><td class="aui_w"></td><td class="aui_c"><div class="aui_inner"><table class="aui_dialog"><tbody><tr><td colspan="2" class="aui_header"><div class="aui_titleBar"><div class="aui_title" style="cursor: move; display: block;"></div><a class="aui_close" href="javascript:/*artDialog*/;" style="display: block;">×</a></div></td></tr><tr><td class="aui_icon" style="display: none;"><div class="aui_iconBg" style="background-image: none; background-position: initial initial; background-repeat: initial initial;"></div></td><td class="aui_main" style="width: auto; height: auto;"><div class="aui_content" style="padding: 0px;"></div></td></tr><tr><td colspan="2" class="aui_footer"><div class="aui_buttons" style="display: none;"></div></td></tr></tbody></table></div></td><td class="aui_e"></td></tr><tr><td class="aui_sw"></td><td class="aui_s"></td><td class="aui_se" style="cursor: auto;"></td></tr></tbody></table></div></div>
    <!--tip start-->
    <div class="mod-tip">
        <div style="con style0green">
            <div class="con style0green Loading" style="display: none; position: fixed; top: 41px; left: 764.5px; z-index: 99999; width: auto; min-width: 350px; height: 37px; line-height: 37px;">
                <!--style0green是成功提示；style0yellow是警告提示；style0red是错误提示-->
                <span id="operateTip" class="txt" onclick="change()" onchange="change()" onmouseup="displayNone()"></span><i class="close"></i>
            </div>
        </div>
    </div>
    <!--tip end-->

    <!--内嵌了一个每隔一段时间向服务器发请求的页面-->

 <div class="RIGHT" style="padding-left:10px;">
                
    <script type="text/javascript">
        var TransportationQuery = new Object();

        TransportationQuery.Groups = new Array(1);
        TransportationQuery.Groups[0] = 'q1';
    </script>
    
       
    


    <div class="clear h10"></div>
    <div class="mod-table">
<!--List Start-->
<div class="mod-table" style=" table-layout: none; ">
	<div class="mod-table-head">
		<div class="con style0list">
			<table>
				<colgroup>
					<col style="width: 20%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 20%;">
				</colgroup>
				<thead>
					<tr align="center">
						<th>售卖区域名称</th>
						<th>首件(重kg)</th>
						<th>运费(元)</th>
						<th>续件(重kg)</th>
						<th>运费(元)</th>
						<th>操作</th>
					</tr>
				</thead>
				<colgroup>
				<col style="width: 20%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 15%;">					
					<col style="width: 20%;">
				</colgroup>
				<tbody>
				</tbody>
			</table>
		</div>
	</div>
</div>
<style>
</style>
<div class="page">
	<div class="pagination pagination-right" id="turn-ul">
		<ul>
			<li><a id="beginPage" class="page-disable">首页</a></li>
			<li><a id="prevPage" class="page-disable">上一页</a></li>
			<li id="pageNumber"></li>
			<li><a id="nextPage">下一页</a></li>
			<li><a id="lastPage">末页</a></li>
		</ul>
	</div>
</div>
<input type="hidden" id="page_count" />
<!--List End-->

</div>
<!--     <script type="text/javascript">

    $(function () {

        //Transportation(1);
    });
</script> -->
     <!--Page Start-->
    <div class="mod-page" style='margin:20px;margin-right:400px;'>
        <div class="con style0list">
            <div class="turn">
                <ul class="turn-ul">
                    <ul class="turn-ul">
                        <li class="last" onclick="Pages('Last')" style="background:url(__IMG__/last_xia.png) no-repeat center ;"></li>
                        <li class="first" onclick="Pages('First')" style="background:url(__IMG__/next_shang.png) no-repeat  center;"></li>
                    </ul>
                </ul>
            </div>
            <div class="number">
                当前<span id="pages"></span>~<span id="number"></span>页,总计<span id="sum"></span>条</div>
        </div>
    </div>
    <!--Page End-->
    <script type="text/javascript">
    $(function() {
    	loadexpress(1);
	});
  //数字跳转页面 2016年11月16日 16:07:24
	var jumpNumber = 1;
	function jumpForPage(obj) {
		jumpNumber = $(obj).text();
		loaduser($(obj).text());
		$(".currentPage").removeClass("currentPage");
		$(obj).addClass("currentPage");
		if (jumpNumber == 1) {
			changeClass("prev");
		} else if (jumpNumber < parseInt($("#page_count").val())) {
			changeClass();
		} else if (jumpNumber == parseInt($("#page_count").val())) {
			changeClass("next");
		}
	}
	$("#beginPage").click(function() {
		jumpNumber = 1;
		loaduser(1);
		changeClass("begin");
	});
	//上一页
	$("#prevPage").click(function() {
		var obj = $(".currentPage");
		var index = parseInt(obj.text()) - 1;
		if (index > 0) {
			obj.removeClass("currentPage");
			obj.prev().addClass("currentPage");
			jumpNumber = index;
			loaduser(index);
			//判断是否是第一页
			if (index == 1) {
				changeClass("prev");
			} else {
				changeClass();
			}
		}
	});
	//下一页
	$("#nextPage").click(function() {
		var obj = $(".currentPage");
		//当前页加一（下一页）
		var index = parseInt(obj.text()) + 1;
		if (index <= $("#page_count").val()) {
			jumpNumber = index;
			loaduser(index);
			obj.removeClass("currentPage");
			obj.next().addClass("currentPage");
			//判断是否是最后一页
			if (index == $("#page_count").val()) {
				changeClass("next");
			} else {
				changeClass();
			}
		}
	});
	//末页
	$("#lastPage").click(
			function() {
				jumpNumber = $("#page_count").val();
				loaduser(jumpNumber);
				$(
						"#pageNumber a:eq("
								+ (parseInt($("#page_count").val()) - 1) + ")")
						.text($("#page_count").val());
				changeClass("next");
			});

  //查询运费模板管理
	function loadexpress(pageindex) {
		$
				.ajax({
					type : "post",
					url : "{:__URL('PLATFORM_MAIN/Express/getShippingFeeList')}",
					async : true,
					data : {
						"pageindex" : pageindex
					},
					success : function(data) {
						//alert(JSON.stringify(data["data"][0]["ext"]));
						$("#page_count").val(data["page_count"]);
						$("#pageNumber a").remove();
						var html = '';
						if (data["data"].length > 0) {
							for (var i = 0; i < data["data"].length; i++) {
								for(var a=0;a < data["data"][i]["ext"].length; a++){
									html += '<tr align="center">';
									html += '<td>' + data["data"][i]["shipping_fee_name"]
											+ '</td>';
									html += '<td>' + data["data"][i]["ext"][a]["snum"]
											+ '</td>';
									html += '<td>' + data["data"][i]["ext"][a]["sprice"]
											+ '</td>';
									html += '<td>' + data["data"][i]["ext"][a]["xnum"]
											+ '</td>';
									html += '<td>' + data["data"][i]["ext"][a]["xprice"]
											+ '</td>';
									html += '</tr>'; 
								}							
							}
						} else {
							html += '<tr align="center"><th colspan="9">暂无符合条件的数据记录</th></tr>';
						}
						$(".style0list tbody").html(html);
						var totalpage = $("#page_count").val();
						if (totalpage <= 9) {
							var i = 0;
							for (i = 1; i <= totalpage; i++) {
								if (jumpNumber == i) {
									$html = "<a   onclick='jumpForPage(this)' class='currentPage'>"
											+ i + "</a>";
								} else {
									$html = "<a   onclick='jumpForPage(this)' >"
											+ i + "</a>";
								}
								$("#pageNumber").append($html);
							}
						} else {
							if (jumpNumber <= 5) {
								for (i = 1; i <= 9; i++) {

									if (jumpNumber == i) {
										$html = "<a   onclick='jumpForPage(this)' class='currentPage'>"
												+ i + "</a>";
									} else {
										$html = "<a   onclick='jumpForPage(this)' >"
												+ i + "</a>";
									}
									$("#pageNumber").append($html);
								}
							} else {
								if ((totalpage - jumpNumber) < 9) {
									var start = totalpage - 8;
									for (i = start; i <= totalpage; i++) {
										if (jumpNumber == i) {
											$html = "<a   onclick='jumpForPage(this)' class='currentPage'>"
													+ i + "</a>";
										} else {
											$html = "<a   onclick='jumpForPage(this)' >"
													+ i + "</a>";
										}
										$("#pageNumber").append($html);
									}
								} else {
									var start = jumpNumber - 4;
									var end = jumpNumber + 4;
									for (i = start; i <= end; i++) {
										if (jumpNumber == i) {
											$html = "<a   onclick='jumpForPage(this)' class='currentPage'>"
													+ i + "</a>";
										} else {
											$html = "<a   onclick='jumpForPage(this)' >"
													+ i + "</a>";
										}
										$("#pageNumber").append($html);
									}
								}
							}
						}
					}
				});
	}
	/* 跳转到添加运费模板 */
	function addExpress(){
		location.href = "{:__URL('PLATFORM_MAIN/Express/addShippingFee')}";
	}
    </script>

</div>
            <!--Right End-->
            <!--确认信息的公用弹层 开始-->
            <div id="dvConfirm" style="display: none;">
                <div class="content" style="min-width: 300px; min-height: 50px;">
                    <div class="mod-form">
                        <div class="con style0alert">
                            <span id="confirmMessage"></span>
                        </div>
                    </div>
                </div>
            </div>
            <!--确认信息的公用弹层 结束-->

{/block}
